<template>
  <div class="wechat-container">
    <div class="wechat-title">{{name || '招商政策'}}</div>

    <div class="wechat-content flex gap-1 ">
      <div class="flex-1 flex flex-item" v-for="item in dataList" :key="item.userInfoData" @click="handleCilck(item)">
        <div class="item-detail-icon">
          <span v-if='!item.TitleImage'>{{name || '招商政策'}}</span>
          <img v-else :src="item.TitleImage" alt="">
        </div>
        <div class="item-info">
          <div class="item-title">
            {{item.Title}}
          </div>
          <div class="item-subtitle">{{item.time}}</div>
        </div>
      </div>

    </div>
  </div>
</template>
<script>
import Carousel from 'ant-design-vue/es/carousel'
import moment from 'moment'
import { getContextsList, saveContexts, getDetailByID } from '@/api/article'

export default {
  components: {
    Carousel
  },
  data () {
    return {
      dataList: [],
      name: ''
    }
  },
  watch: {},
  created () {
this.name = this.$route.query.name
    this.init()
  },
  methods: {
    async init () {
       const query = this.$route.query
       console.log('aaaaaaaaa', query.id)
      const { data } = await getContextsList({ pageSize: 100,CategoryTypeID: query.id })
      this.dataList = data && data.length > 0 ? data.map((el, idx) => {
        return {
          ...el,
          time: moment(el.AddTime).format('YYYY-MM-DD HH:mm:ss')
        }
      }) : []
    },
    handleCilck (row) {
      this.$router.push({
        name: 'contentDetails', query: {
          id: row.id
        }
      })
    }
  }
}
</script>
<style lang="less" scoped>
@import './wechat.less';
</style>
